<?php
namespace app\models;

use yii\db\ActiveRecord;

class User extends ActiveRecord
{

	public static function tableName()
	{
		return '{{%user}}';
	}

	public function getUser($id)
	{
		//$query = new Query;
		$data = User::find()->where('id = '.$id)->asarray()->one();
		var_dump($data);
	}

	public function addUser($name, $password)
	{
		$this->uid      = rand(1000,9999);
		$this->name     = $name;
		$this->password = $password;
		$this->token    = md5(time());
		$this->add_time = time();
		return $this->insert();
	}

	public function getOneToTen()
	{
		//$query = new Query;
		$data = User::find()->where('id = '.$id)->asarray()->one();
		var_dump($data);
	}
}